@echo off
echo "==>TAO_ROOT=%TAO_ROOT%"

set PROJECT_PATH="%TAO_ROOT%/orbsvcs/DevGuideExamples/EventServices/OMG_SupplierSideEC"
cd %PROJECT_PATH%

@echo off
setlocal

:: 定义要删除的文件列表
set "files=ns.ior es.ior"

:: 遍历文件列表并删除存在的文件
for %%f in (%files%) do (
    if exist "%%f" (
        echo Deleting %%f...
        del "%%f"
        if not errorlevel 1 (
            echo Deleted %%f successfully.
        ) else (
            echo Error deleting %%f.
        )
    ) else (
        echo %%f does not exist. Skipping.
    )
)


::1) Start tao_ft_naming
echo "==>Start Naming_Service
start "tao_cosnaming" cmd /k "%TAO_ROOT%/orbsvcs/Naming_Service/tao_cosnaming -ORBdebuglevel 0 -ORBListenEndpoints iiop://:2809  -o %PROJECT_PATH%/ns.ior"
timeout /t 3

::4) Start test object EchoEventSupplier
echo "==>Start EchoEventSupplier
start "EchoEventSupplier" cmd /k "EchoEventSupplier -ORBInitRef NameService=file://%PROJECT_PATH%/ns.ior"
timeout /t 3

::5) Start test object EchoEventSupplier
echo "==>Start EchoEventSupplier
start "EchoEventConsumer" cmd /k "EchoEventConsumer -ORBInitRef NameService=file://%PROJECT_PATH%/ns.ior"

pause >nul
@echo off